
/**
** \file       options_parser.h
**
** \brief      functions and structures declared here aim to manage options
**
** \authors    Ben M'rad Hanna, Boillot Ulysse, De Oliveira Guillaume,
**             Laterem Hamza and Nguyen Viet Dung.
**
** \version    0.8
**
** \date       26  November 2010
**
*/

#ifndef OPTIONS_PARSER_H_
# define OPTIONS_PARSER_H_

# include <libgen.h>
# include <string.h>
# include <unistd.h>
# include <stdio.h>
# include <stdlib.h>

/**
** \struct     s_opt
**
** \brief      the structure s_opt has 3 fields :
**                     - its name
**                     - the arguments linked to it
**                     - the next option
**
*/

typedef struct          opt
{
    char                *name;
    char                *aux;
    struct opt          *next;
}                       s_opt;

/**
** \struct     s_file
**
** \brief      the structure s_file has 2 fields :
**                     - its name
**                     - the next file
**
*/

typedef struct          file
{
    char                *name;
    struct file         *next;
}                       s_file;

/**
** \struct     s_cmd
**
** \brief      the structure s_cmd has 2 fields :
**                     - the options given in the command line
**                     - the files given in the command line
**
*/

typedef struct          cmd
{
    s_opt               *opt;
    s_file              *file;
}                       s_cmd;

/**
**      \fn     s_cmd    *option_parser(int    argc,
**                                     char    **argv,
**                                     int     *ret);
**
**      \brief  The function parses the command line with the option to use.
**
**      \param  argc Number of arguments send to the program.
**              argv The arguments send to the program.
**              ret  This pointer represents the return value
**
**      \return return an integer, (0) if correct, (1) else.
**
*/

s_cmd   *option_parser(int                      argc,
                       char                     **argv,
                       int                      *ret);

#endif /* !OPTIONS_PARSER_H_ */
